﻿using System;
using Microsoft.Phone.Controls;

namespace PaulWade.MVVMlightNavigationService
{
    public class NavigationService : INavigationService
    {
        public PhoneApplicationFrame RootFrame { get; set; }

        public NavigationService(PhoneApplicationFrame rootframe)
        {
            RootFrame = rootframe;
        }

        public void Navigate<T>()
        {
            var type = typeof(T);

            var testvalue = (type.FullName.Substring(type.FullName.IndexOf('.')).Replace('.', '/')) + ".xaml";

            RootFrame.Navigate(new Uri(testvalue, UriKind.Relative));

        }
    }
}

